<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<jsp:include page="/common/meta.jsp"></jsp:include>
<jsp:include page="/common/css_js.jsp"></jsp:include>
<script>
	$(document).ready(
			function() {
				$("#name").focus();
				$("#inputForm").validate({
									rules : {
										name  : {
											required : true,
											maxlength : 30,
											isResourcesName : true,
											remote : "authority!checkResourceName.action?oldRoleName="
												+ encodeURIComponent('${name}')
										},
										menuName   : {
											maxlength : 127,
											stringCheckAll : true,
											required : true
										}
										
									},
									messages : {
										name  : {
											required : "权限标识不能为空",
											remote : "权限标识已存在",
											isResourcesName : "资源标识输入有误,格式为: xx_xx", 
											maxlength : "权限标识最多为30位"
										},
										menuName : {
											required : "权限不能为空",
											stringCheckAll : "不能有特殊字符", 
											maxlength : "权限最多为127位"
										}
									}
							});
			});
</script>
</head>

<body>
	<s:if test="id == null">
		<jsp:include page="/common/content_top.jsp"><jsp:param name="title" value="新增权限"/></jsp:include>
	</s:if>
	<s:else>
		<jsp:include page="/common/content_top.jsp"><jsp:param name="title" value="修改权限"/></jsp:include>
	</s:else>
	<br/>
	<form id="inputForm" action="authority!save.action" method="post">
		<input type="hidden" name="id" value="${id}" />
		<table border="0" style="margin-left: 30px;">
			<tr>
				<td align="right">权限标识:</td>
				<td><input type="text" id="name" name="name" size="40"
					id="name" value="${name}" />
				</td>
			</tr>			
			<tr>
				<td align="right">权限:</td>
				<td><input type="text" id="menuName" name="menuName" size="40"
					id="name" value="${menuName}" />
				</td>
			</tr>
			<tr>
				<td align="right">权限资源:</td>
				<td><s:checkboxlist name="checkedResourceIds" list="allResourceList"
						listKey="id" listValue="name" theme="custom" /></td>
			</tr>
			<tr>
				<td colspan="2" align="center"><security:authorize ifAnyGranted="authority_update">
						<input class="button" type="submit" value="提交" />&nbsp;
					</security:authorize> <input class="button" type="button" value="返回"
					onclick="history.back()" /></td>
			</tr>
		</table>
	</form>
<jsp:include page="/common/content_bottom.jsp"/>
</body>
</html>
